package cn.hyp.bantang.module.finance.controller.admin.parse;

import cn.hyp.bantang.framework.common.pojo.CommonResult;
import cn.hyp.bantang.module.finance.pdf.Finance;
import cn.hyp.bantang.module.finance.service.parse.ParseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.hyp.bantang.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 财报解析")
@RestController
@RequestMapping("/finance/parse")
@Validated
public class ParseController {

    @Resource
    private ParseService parseService;

    @GetMapping("/pdf")
    @Operation(summary = "解析pdf")
    public CommonResult<Finance> pdf(@RequestParam(defaultValue = "G:\\code\\labs\\tabula-java\\src\\test\\resources\\technology\\tabula\\mt.PDF") String pdfPath) {
        return success(parseService.parse(pdfPath));
    }

}